package com.lancoo.answer.util.paperUtils;

import android.os.Bundle;
import android.util.Log;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.lancoo.answer.helper.NoConfirmDialogHelper;
import com.lancoo.answer.helper.SingleConfirmDialogHelper;
import com.lancoo.answer.helper.answer.FillAnswerDialog;
import com.lancoo.answer.helper.answer.FillAnswerFragment;
import com.lancoo.answer.model.AnswerConstant;
import com.lancoo.answer.model.ConstantBean;
import com.lancoo.answer.model.bean.Child;
import com.lancoo.answer.model.bean.ImgAnswerCallBackBean;
import com.lancoo.answer.model.bean.Item;
import com.lancoo.answer.model.entity.IndexBean;
import com.lancoo.answer.model.entity.TaskControlBean;
import com.lancoo.answer.model.entity.TaskOperateBean;
import com.lancoo.answer.model.eventBean.AnswerSheetEventBean;
import com.lancoo.answer.model.eventBean.SwitchQuesEventBean;
import com.lancoo.answer.ui.child.lookReview.ChildClozeLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.ChildFillLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.ChildMatchLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.ChildReadMatchLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.ChildSelectLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.CompositionLookReviewFragment;
import com.lancoo.answer.ui.child.lookReview.PassageDictationLookReviewFragment;
import com.lancoo.answer.ui.child.original.ChildFillOriginalFragment;
import com.lancoo.answer.ui.child.original.ChildMatchOriginalFragment;
import com.lancoo.answer.ui.child.original.ChildReadMatchOriginalFragment;
import com.lancoo.answer.ui.child.original.ChildSelectOriginalFragment;
import com.lancoo.answer.ui.child.original.CompositionOriginalFragment;
import com.lancoo.answer.ui.child.original.PassageDictationOriginalFragment;
import com.lancoo.answer.ui.child.training.ChildBriefAnswerFragment;
import com.lancoo.answer.ui.child.training.ChildBriefListAnswerFragment;
import com.lancoo.answer.ui.child.training.ChildBriefNoAskAnswerFragment;
import com.lancoo.answer.ui.child.training.ChildSelectAnswerFragment;
import com.lancoo.answer.ui.child.training.ChildSpokenAnswerFragment;
import com.lancoo.answer.ui.child.training.ChildWordListenWriteAnswerFragment;
import com.lancoo.answer.ui.child.training.CompositionAnswerFragment;
import com.lancoo.answer.ui.paper.PaperFragment;
import com.lancoo.answer.ui.ques.IntroductionFragment;
import com.lancoo.answer.ui.ques.NoSpliteLayoutFragment;
import com.lancoo.answer.ui.ques.SpliteLayoutFragment;
import com.lancoo.answer.ui.ques.quesBody.CompoundMatchQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.CompoundMatchQuseBodyLookingFragment;
import com.lancoo.answer.ui.ques.quesBody.CompoundWritingQuesBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.EmptyQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.HightLightQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.ListenArticleQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.NormalQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.TranslationQuseBodyFragment;
import com.lancoo.answer.ui.ques.quesBody.WanXingFillQuseBodyFragment;
import com.lancoo.answer.view.fragment.cloze.ClozeFragment;
import com.lancoo.answer.view.fragment.composition.alternative.CompositionAlternativeAnswerFragment;
import com.lancoo.answer.view.fragment.composition.alternative.SubCompositionAnswerFragment;
import com.lancoo.answer.view.fragment.composition.answer.CompositionAudioAnswerFragment;
import com.lancoo.answer.view.fragment.composition.answer.CompositionPencilAnswerFragment;
import com.lancoo.answer.view.fragment.composition.answer.CompositionPictureAnswerFragment;
import com.lancoo.answer.view.fragment.composition.answer.CompositionVideoAnswerFragment;
import com.lancoo.answer.view.fragment.composition.continuation.CompositionContinuationAnswerFragment;
import com.lancoo.answer.view.fragment.composition.continuation.sub.ContinuationAudioAnswerFragment;
import com.lancoo.answer.view.fragment.correctmistake.AnalysisCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.correctmistake.FavoriteCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.correctmistake.LookingCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.correctmistake.PracticeCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.correctmistake.WrongCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.dictation.PassageDictationAnswerFragment;
import com.lancoo.answer.view.fragment.dictation.answer.PassageDictationPencilAnswerFragment;
import com.lancoo.answer.view.fragment.fill.FillChildFragment;
import com.lancoo.answer.view.fragment.listenmatch.ListenMatchAnalysisFragment;
import com.lancoo.answer.view.fragment.listenmatch.ListenMatchAnswerFragment;
import com.lancoo.answer.view.fragment.listenmatch.ListenParagraphAnalysisFragment;
import com.lancoo.answer.view.fragment.listenmatch.ListenParagraphFragment;
import com.lancoo.answer.view.fragment.manual.ManualAnswerFragment;
import com.lancoo.answer.view.fragment.option.MultiChildFragment;
import com.lancoo.answer.view.fragment.option.OptionFragment;
import com.lancoo.answer.view.fragment.option.OptionLookingFragment;
import com.lancoo.answer.view.fragment.option.OptionOriginalLookingFragment;
import com.lancoo.answer.view.fragment.paragraphSort.ParagraphSortingChildLookingFragment;
import com.lancoo.answer.view.fragment.paragraphSort.ParagraphSortingFragment;
import com.lancoo.answer.view.fragment.readMatch.ReadMatchFragment;
import com.lancoo.answer.view.fragment.readMatch.ReadingComprehensionFragment;
import com.lancoo.answer.view.fragment.translate.TranslateChapterAnswerFragment;
import com.lancoo.answer.view.fragment.translate.TranslateChapterAnswerLookingFragment;
import com.lancoo.answer.view.fragment.webquesBody.WebQuesBodyLookingFragment;
import com.lancoo.answer.view.fragment.webquesBody.WebQuesBodyOriginalLookingFragment;
import com.rxjava.rxlife.RxLife;

import org.greenrobot.eventbus.EventBus;

import java.util.List;
import java.util.concurrent.TimeUnit;

import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;

/**
 * Created by pengmi on 2021/12/20 18:28
 * Description:Fragment之间逻辑调用处理工具类
 */
public class FragmentCommunicationUtils {


    /**
     * 自动进入下一个题作答
     *
     * @param currentFragment fragment;
     * @param hasDelayTime    是否延迟;
     */
    public static void autoNextQuesFragment(Fragment currentFragment, boolean hasDelayTime) {
        Single.timer(hasDelayTime ? AnswerConstant.TIME_INTERVAL_AUTO_JUMP_NEXT_QUES : 0, TimeUnit.MILLISECONDS)
                .observeOn(AndroidSchedulers.mainThread())
                .as(RxLife.as(currentFragment))
                .subscribe(aLong -> {
                    Fragment parentFragment = currentFragment.getParentFragment();
                    if (parentFragment instanceof SpliteLayoutFragment) {
                        boolean enableSwitchQues = ((SpliteLayoutFragment) parentFragment).autoToNextChild();
                        if (enableSwitchQues) {
                            Fragment parentFragment1 = parentFragment.getParentFragment();
                            if (parentFragment1 instanceof PaperFragment) {
                                ((PaperFragment) parentFragment1).jumpNextQuese();
                            }
                        }
                    } else if (parentFragment instanceof NoSpliteLayoutFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    } else if (parentFragment instanceof PaperFragment) {
                        ((PaperFragment) parentFragment).jumpNextQuese();
                    } else if (parentFragment instanceof ReadMatchFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    } else if (parentFragment instanceof ParagraphSortingFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    } else if (parentFragment instanceof ClozeFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    } else if (parentFragment instanceof ReadingComprehensionFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    } else if (parentFragment instanceof OptionFragment) {
                        Fragment parentFragment1 = parentFragment.getParentFragment();
                        if (parentFragment1 instanceof PaperFragment) {
                            ((PaperFragment) parentFragment1).jumpNextQuese();
                        }
                    }
                });
    }

    /**
     * 切换viewpager2的item
     *
     * @param childIndex itemIndex
     */
    public static void switchChildIndexToViewPager(Fragment currentFragment,int quesIndex,int childIndex, int itemIndex) {
        if (currentFragment == null) {
            return;
        }
        Fragment parentFragment = currentFragment.getParentFragment();
        if (parentFragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) parentFragment).jumpToAimChildFragment(quesIndex,childIndex, itemIndex,1);
        }else if (parentFragment instanceof NoSpliteLayoutFragment) {
            ((NoSpliteLayoutFragment) parentFragment).jumpToAimChildFragment(quesIndex,childIndex, itemIndex);
        }
    }

    /**
     * 整份大题获取当前小题的ChildIndex
     *
     * @param fragment 大题fragment
     * @return childIndex
     */
    public static int getCurrentQuesChildIndex(Fragment fragment) {
        if (fragment instanceof SpliteLayoutFragment) {
            return ((SpliteLayoutFragment) fragment).getCurrentChildIndex();
        } else if (fragment instanceof ReadMatchFragment) {
            return ((ReadMatchFragment) fragment).getCurrentSmallQueseIndex();
        } else if (fragment instanceof ClozeFragment) {
            return ((ClozeFragment) fragment).getRealIndex();
        }else if(fragment instanceof ListenMatchAnswerFragment){
            return ((ListenMatchAnswerFragment) fragment).getRealIndex();
        }else if(fragment instanceof ListenMatchAnalysisFragment){
            return ((ListenMatchAnalysisFragment) fragment).getRealIndex();
        }else if (fragment instanceof OptionFragment) {
            return ((OptionFragment) fragment).getChildIndex();
        }else if (fragment instanceof OptionLookingFragment) {
            return ((OptionLookingFragment) fragment).getChildIndex();
        }else if (fragment instanceof OptionOriginalLookingFragment) {
            return ((OptionOriginalLookingFragment) fragment).getChildIndex();
        }
        return 0;
    }

    /**
     * 获取当前小题的ItemIndex
     *
     * @param fragment 大题fragment
     * @return itemIndex
     */
    public static int getCurrentQuesItemIndex(Fragment fragment) {
        if (fragment instanceof SpliteLayoutFragment) {
            return ((SpliteLayoutFragment) fragment).getCurrentItemIndex();
        } else if (fragment instanceof OptionFragment) {
            return ((OptionFragment) fragment).getRealIndex();
        } else if (fragment instanceof ParagraphSortingFragment) {
            return ((ParagraphSortingFragment) fragment).getItemIndex();
        } else if (fragment instanceof WebQuesBodyLookingFragment) {
            return ((WebQuesBodyLookingFragment) fragment).getRealIndex();
        } else if (fragment instanceof WebQuesBodyOriginalLookingFragment) {
            return ((WebQuesBodyOriginalLookingFragment) fragment).getRealIndex();
        } else if (fragment instanceof FillChildFragment) {
            return ((FillChildFragment) fragment).getCurrentIndex();
        } else if (fragment instanceof ChildMatchLookReviewFragment) {
            return ((ChildMatchLookReviewFragment) fragment).getCurrentItemIndex();
        } else if (fragment instanceof PracticeCorrectMistakesFragment) {
            return ((PracticeCorrectMistakesFragment) fragment).getCurrentIndex();
        } else if (fragment instanceof ListenParagraphFragment) {
            return ((ListenParagraphFragment) fragment).getRealIndex();
        }else if (fragment instanceof ListenParagraphAnalysisFragment) {
            return ((ListenParagraphAnalysisFragment) fragment).getRealIndex();
        }
        else if (fragment instanceof CompoundMatchQuseBodyFragment) {
            return ((CompoundMatchQuseBodyFragment) fragment).getRealIndex();
        } else if (fragment instanceof CompoundMatchQuseBodyLookingFragment) {
            return ((CompoundMatchQuseBodyLookingFragment) fragment).getRealIndex();
        }else if (fragment instanceof OptionLookingFragment) {
            return ((OptionLookingFragment) fragment).getRealIndex();
        }else if (fragment instanceof OptionOriginalLookingFragment) {
            return ((OptionOriginalLookingFragment) fragment).getRealIndex();
        }
        return 0;
    }

    /**
     * 点击答题卡选项跳转指定Fragment
     *
     * @param fragment         大题fragment
     * @param answerSheetEvent eventBean
     * @param taskOperateBean  bean
     */
    public static void gotoAimFragment(Fragment fragment, AnswerSheetEventBean answerSheetEvent,
                                       TaskOperateBean taskOperateBean) {
        int childIndex = answerSheetEvent.getChildIndex();
        int itemIndex = answerSheetEvent.getItemIndex();
        if(fragment!=null){
            Log.e("eeee",fragment.getClass().getName());
        }
        if (fragment instanceof SpliteLayoutFragment) {//通用上下分栏界面
            ((SpliteLayoutFragment) fragment).jumpToAimChildFragment(childIndex, itemIndex, 0);
        }else if (fragment instanceof NoSpliteLayoutFragment) {//通用上下分栏界面
            ((NoSpliteLayoutFragment) fragment).jumpToAimChildFragment(answerSheetEvent.getQuesIndex(), childIndex,itemIndex);
        } else if (fragment instanceof ReadMatchFragment) {
            ((ReadMatchFragment) fragment).jumpToAimChildFragment(childIndex);
        } else if (fragment instanceof ParagraphSortingFragment) {
            ((ParagraphSortingFragment) fragment).jumpToAimChildFragment(itemIndex);
        } else if (fragment instanceof OptionFragment) {
            ((OptionFragment) fragment).jumpToAimChildFragment(childIndex,itemIndex);
        } else if (fragment instanceof ClozeFragment) {
            ((ClozeFragment) fragment).jumpToAimChildFragment(childIndex);
        } else if (fragment instanceof WebQuesBodyLookingFragment) {
            ((WebQuesBodyLookingFragment) fragment).setCurrentItem(itemIndex);
        } else if (fragment instanceof WebQuesBodyOriginalLookingFragment) {
            ((WebQuesBodyOriginalLookingFragment) fragment).setCurrentItem(itemIndex);
        } else if (fragment instanceof OptionLookingFragment) {
            ((OptionLookingFragment) fragment).jumpToAimChildFragment(childIndex,itemIndex);
        } else if (fragment instanceof OptionOriginalLookingFragment) {
            ((OptionOriginalLookingFragment) fragment).jumpToAimChildFragment(childIndex, itemIndex);
        } else if (fragment instanceof PracticeCorrectMistakesFragment) {
            ((PracticeCorrectMistakesFragment) fragment).setCurrentItemIndex(itemIndex);
        }  else {
            List<Child> childList = taskOperateBean.getQuesBean().getChildList();
            if (childList == null || childList.size() == 0) {
                return;
            }
            List<Item> itemList = childList.get(0).getItemList();
            if (itemList == null) {
                return;
            }
            int size = itemList.size();
            if (childList.size() > size) {
                taskOperateBean.setDefaultLoadIndex(childIndex);
            } else {
                taskOperateBean.setDefaultLoadIndex(itemIndex);
            }
            taskOperateBean.setDefaultLoadChildIndex(childIndex);
            taskOperateBean.setDefaultLoadItemIndex(itemIndex);
            Log.e("0726","试题已销毁，需重新创建，保留当前下标");
        }
    }

    /**
     * 同步处理大题题干内容交互
     *
     * @param fragment          大题fragment
     * @param currentChildIndex childIndex
     */
    public static void dealWithQuesBodyInteraction(Fragment fragment, int currentChildIndex) {
        if (fragment instanceof TranslationQuseBodyFragment) {
            ((TranslationQuseBodyFragment) fragment).onClickItemIndex(currentChildIndex, 0);
        } else if (fragment instanceof WanXingFillQuseBodyFragment) {
            Fragment parentFragment = fragment.getParentFragment();
            dealWithQuesBodyInteraction(parentFragment, currentChildIndex);
        } else if (fragment instanceof NormalQuseBodyFragment) {
            Fragment parentFragment = fragment.getParentFragment();
            dealWithQuesBodyInteraction(parentFragment, currentChildIndex);
        } else if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).jumpToAimChildFragment(currentChildIndex, 0,4);
        }
    }
    /**
     * 同步题干Fragment交互处理
     *
     * @param fragment  题干0713fragment
     * @param currentChildIndex childIndex
     */
    public static void synchroTopFragment(Fragment fragment, int currentChildIndex) {
        if (fragment instanceof TranslationQuseBodyFragment) {
            ((TranslationQuseBodyFragment) fragment).onClickItemIndex(currentChildIndex, 0);
        } else if (fragment instanceof CompoundWritingQuesBodyFragment) {
            ((CompoundWritingQuesBodyFragment) fragment).onClickItemIndex(currentChildIndex);
        } else if (fragment instanceof CompoundMatchQuseBodyFragment) {
            ((CompoundMatchQuseBodyFragment) fragment).onClickItemIndex(currentChildIndex,0);
        } else if (fragment instanceof CompoundMatchQuseBodyLookingFragment) {
            ((CompoundMatchQuseBodyLookingFragment) fragment).onClickItemIndex(currentChildIndex,0);
        } else if (fragment instanceof WanXingFillQuseBodyFragment) {
            ((WanXingFillQuseBodyFragment) fragment).loadItemIndex(currentChildIndex,0);
        }
    }

    /**
     * 跳转到指定答题点
     *
     * @param fragment  大题frgment
     * @param itemIndex 答题点下标
     */
    public static void jumpToItemFragment(Fragment fragment, int childIndex,int itemIndex) {
        if (fragment instanceof FillChildFragment) {
            ((FillChildFragment) fragment).jump(itemIndex);
        } else if (fragment instanceof TranslateChapterAnswerFragment) {
            ((TranslateChapterAnswerFragment) fragment).chooseClausesItemIndex(itemIndex);
        } else if (fragment instanceof ChildMatchLookReviewFragment) {
            ((ChildMatchLookReviewFragment) fragment).onClick(itemIndex);
        } else if (fragment instanceof WebQuesBodyLookingFragment) {
            ((WebQuesBodyLookingFragment) fragment).setCurrentItem(itemIndex);
        } else if (fragment instanceof WebQuesBodyOriginalLookingFragment) {
            ((WebQuesBodyOriginalLookingFragment) fragment).setCurrentItem(itemIndex);
        } else if (fragment instanceof NormalQuseBodyFragment) {
            ((NormalQuseBodyFragment) fragment).loadItemIndex(childIndex,itemIndex);
        }else if (fragment instanceof ListenParagraphFragment) {
            ((ListenParagraphFragment) fragment).setCurrentItem(itemIndex);
        }else if (fragment instanceof ListenParagraphAnalysisFragment) {
            ((ListenParagraphAnalysisFragment) fragment).setCurrentItem(itemIndex);
        }else if (fragment instanceof ListenMatchAnswerFragment){
            ((ListenMatchAnswerFragment)fragment).jumpToAimChildFragment(itemIndex);
        }else if (fragment instanceof ListenMatchAnalysisFragment){
            ((ListenMatchAnalysisFragment)fragment).jumpToAimChildFragment(itemIndex);
        }else if (fragment instanceof CompoundWritingQuesBodyFragment){
            ((CompoundWritingQuesBodyFragment)fragment).onClickItemIndex(childIndex);
        }else if (fragment instanceof CompoundMatchQuseBodyFragment){
            ((CompoundMatchQuseBodyFragment)fragment).onClickItemIndex(childIndex,itemIndex);
        }else if (fragment instanceof CompoundMatchQuseBodyLookingFragment){
            ((CompoundMatchQuseBodyLookingFragment)fragment).onClickItemIndex(childIndex,itemIndex);
        }else if (fragment instanceof WanXingFillQuseBodyFragment){
            ((WanXingFillQuseBodyFragment)fragment).loadItemIndex(childIndex,itemIndex);
        }
    }

    /**
     * 软件盘显隐状态处理
     *
     * @param fragment fragment
     * @param isShow   boolean
     */
    public static void showSoftKeyBoardState(Fragment fragment, boolean isShow) {
        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).updateSplitLayout(isShow);
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if (fragment instanceof CompositionAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if (fragment instanceof PassageDictationAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if (fragment instanceof CompositionAudioAnswerFragment) {
            ((CompositionAudioAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof CompositionPictureAnswerFragment) {
            ((CompositionPictureAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof ManualAnswerFragment) {
            ((ManualAnswerFragment) fragment).updateSplitLayout(isShow);
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if (fragment instanceof TranslateChapterAnswerFragment) {
            ((TranslateChapterAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof FillChildFragment) {
            ((FillChildFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof ChildBriefAnswerFragment) {
            ((ChildBriefAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof ChildBriefListAnswerFragment) {
            ((ChildBriefListAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof ChildBriefNoAskAnswerFragment) {
            ((ChildBriefNoAskAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof CompositionPencilAnswerFragment) {
            ((CompositionPencilAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof PassageDictationPencilAnswerFragment) {
            ((PassageDictationPencilAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if (fragment instanceof CompositionAlternativeAnswerFragment) {//作文题二选一
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if (fragment instanceof SubCompositionAnswerFragment) {//作文题二选一作答子fragment
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }
        } else if(fragment instanceof ContinuationAudioAnswerFragment){//读后续写文本作答
            ((ContinuationAudioAnswerFragment) fragment).updateKeyboardShowState(isShow);
        } else if(fragment instanceof CompositionContinuationAnswerFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                showSoftKeyBoardState(childFragment, isShow);
            }//CompositionContinuationAnswerFragment
        }
    }

    /**
     * 关闭所有的音频播放
     */
    public static void closeAllMediaPlay(Fragment fragment) {
        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).pauseQuesAudioPlay();
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                closeAllMediaPlay(childFragment);
            }
        } else if (fragment instanceof NoSpliteLayoutFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                closeAllMediaPlay(childFragment);
            }
        } else if (fragment instanceof PaperFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                closeAllMediaPlay(childFragment);
            }
        } else if (fragment instanceof ChildSelectAnswerFragment) {
            ((ChildSelectAnswerFragment) fragment).pauseChildAudioPlay();
        } else if (fragment instanceof ChildSelectLookReviewFragment) {
            ((ChildSelectLookReviewFragment) fragment).pauseChildAudioPlay();
        } else if (fragment instanceof ChildWordListenWriteAnswerFragment) {
            ((ChildWordListenWriteAnswerFragment) fragment).pauseChildAudioPlay();
        } else if (fragment instanceof CompositionLookReviewFragment) {
            ((CompositionLookReviewFragment) fragment).pauseAnswerAudioPlay();
        } else if (fragment instanceof CompositionAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                closeAllMediaPlay(childFragment);
            }
        } else if (fragment instanceof ManualAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment : fragments) {
                closeAllMediaPlay(childFragment);
            }
        } else if (fragment instanceof CompositionAudioAnswerFragment) {
            ((CompositionAudioAnswerFragment) fragment).pause();
        } else if (fragment instanceof CompositionAlternativeAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAllMediaPlay(f);
            }
        } else if (fragment instanceof SubCompositionAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAllMediaPlay(f);
            }
        }
    }

    /**
     * 切换试题发送事件（考试专用）
     */
    public static void switchTestQuesionToEvent(int typeIndex, int quesIndex, int childIndex,
                                                boolean isLeaderPage, int switchType) {
        TaskControlBean taskControlBean = ConstantBean.Companion.getTaskControlBean();
        if (taskControlBean == null) {
            return;
        }
        IndexBean indexBean = ConstantBean.Companion.getSkipToAimIndexBean();
        if (indexBean != null) {
            if (indexBean.getTypeIndex() != typeIndex ||
                    indexBean.getQuesIndex() != quesIndex ||
                    indexBean.getChildIndex() != childIndex) {
                return;
            }
        }
        ConstantBean.Companion.setSkipToAimIndexBean(null);
        SwitchQuesEventBean switchQuesEventBean = new SwitchQuesEventBean();
        switchQuesEventBean.setTypeIndex(typeIndex);
        switchQuesEventBean.setQuesIndex(quesIndex);
        switchQuesEventBean.setChildIndex(childIndex);
        switchQuesEventBean.setSwitchType(switchType);
        switchQuesEventBean.setIsLeaderPage(isLeaderPage ? 1 : 0);
        EventBus.getDefault().post(switchQuesEventBean);
    }

    /**
     * 自动播放音频 过关训练专用
     */
    public static void autoPlayAudio(Fragment fragment) {
        if (fragment == null) {
            return;
        }
        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).audioPlayAudio();
            List<Fragment> fragments1 = fragment.getChildFragmentManager().getFragments();
            for (Fragment f1 : fragments1) {
                if (f1 instanceof ChildSelectAnswerFragment) {
                    ((ChildSelectAnswerFragment) f1).changeAnswerStyle();
                }else   if (f1 instanceof PassageDictationAnswerFragment) {
                    ((PassageDictationAnswerFragment) f1).enableAnswer();
                }
            }
        } else if (fragment instanceof NoSpliteLayoutFragment) {
            ((NoSpliteLayoutFragment) fragment).audioPlayAudio();
        }
    }


    /**
     * 更新小题作答倒计时样式 考试专用
     *
     * @param countdown 倒计时秒数
     * @param isShow    是否显示倒计时样式
     */
    public static void updateChildAnswerCountdown(Fragment fragment, int countdown, boolean isShow) {

        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).updateChildCountdown(countdown, isShow);
        }
    }

    public static void updateQuesAudioPlayState(Fragment fragment, boolean isPlaying) {
        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).updateExamPlayState(isPlaying);
        }
    }

    /**
     * 关闭音频作答进程
     *
     * @param fragment fragment
     */
    public static void closeAudioAnswerProcess(Fragment fragment) {
        if (fragment instanceof PaperFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof SpliteLayoutFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof NoSpliteLayoutFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof CompositionAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof CompositionAudioAnswerFragment) {
            ((CompositionAudioAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof FillChildFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof FillAnswerDialog) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof FillAnswerFragment) {
            ((FillAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof ChildBriefAnswerFragment) {
            ((ChildBriefAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof ChildBriefListAnswerFragment) {
            ((ChildBriefListAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof ChildBriefNoAskAnswerFragment) {
            ((ChildBriefNoAskAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof TranslateChapterAnswerFragment) {
            ((TranslateChapterAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof ChildSpokenAnswerFragment) {
            ((ChildSpokenAnswerFragment) fragment).closeAudioAnswer();
        } else if (fragment instanceof CompositionAlternativeAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        } else if (fragment instanceof SubCompositionAnswerFragment) {
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f : fragments) {
                closeAudioAnswerProcess(f);
            }
        }
    }

    public static void testEventBus() {
//        EventBus.getDefault().post(new VideoEventBean());
    }

    /***
     * 修改childFragment里边的默认加载index
     */
    public static void changeDefaultChildIndex(Fragment fragment,int defaulChildIndex){
        if(fragment instanceof ListenParagraphFragment||
                fragment instanceof ListenMatchAnswerFragment||
                fragment instanceof FillChildFragment||
                fragment instanceof ChildClozeLookReviewFragment){
            Bundle arguments = fragment.getArguments();
            if(arguments!=null){
                arguments.putInt(AnswerConstant.KEY_LOADCHILDINDEX,defaulChildIndex);
                fragment.setArguments(arguments);
            }
        }else if(fragment instanceof SpliteLayoutFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment subFragment:fragments){
                changeDefaultChildIndex(subFragment,defaulChildIndex);
            }
        }
    }

    /**
     * 禁止viewpager2临时滑动
     * @param fragment fragment
     */
    public static void unableVpChange(Fragment fragment){
        if(fragment!=null){
            Fragment parentFragment = fragment.getParentFragment();
            if(parentFragment instanceof PaperFragment){
                ((PaperFragment)parentFragment).disableVpScorll();
            }
        }
        if(fragment instanceof SpliteLayoutFragment){
            ((SpliteLayoutFragment)fragment).disableVpScorll();
        }

    }

    public static void matchingSynthesisReposition(Fragment fragment){
        if(fragment instanceof SpliteLayoutFragment){
            ((SpliteLayoutFragment)fragment).reposition();
        }
    }

    /**
     * 字体调整
     */
    public static void adjustFontSize(Fragment fragment){
        if(fragment instanceof PaperFragment ){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f:fragments){
                adjustFontSize(f);
            }
        }else if(fragment instanceof IntroductionFragment){
            ((IntroductionFragment)fragment).adjustFontSize();
        }else if(fragment instanceof NoSpliteLayoutFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f:fragments){
                adjustFontSize(f);
            }
        }else if(fragment instanceof SpliteLayoutFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f:fragments){
                adjustFontSize(f);
            }
            ((SpliteLayoutFragment)fragment).adjustFontSize();
        }else if(fragment instanceof PassageDictationAnswerFragment){//短文听写
            ((PassageDictationAnswerFragment)fragment).adjustFontSize();
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f:fragments){
                adjustFontSize(f);
            }
        }else if(fragment instanceof CompositionAudioAnswerFragment){//图片作答
            ((CompositionAudioAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompositionPictureAnswerFragment){//图片作答
            ((CompositionPictureAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompositionVideoAnswerFragment){//视频作答
            ((CompositionVideoAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof PassageDictationPencilAnswerFragment){//文本作答
            ((PassageDictationPencilAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof FillChildFragment){//听力填空
            ((FillChildFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildClozeLookReviewFragment){//语法选择，完形填空，对话选择
            ((ChildClozeLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ListenParagraphFragment){//听力匹配  听力排序
            ((ListenParagraphFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ListenMatchAnswerFragment){//听力综合
            ((ListenMatchAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildBriefAnswerFragment){//通用简答
            ((ChildBriefAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompositionAnswerFragment){//通用作文
            ((CompositionAnswerFragment)fragment).adjustFontSize();
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment f:fragments){
                adjustFontSize(f);
            }
        }else if(fragment instanceof ChildSelectAnswerFragment){//通用选择
            ((ChildSelectAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof MultiChildFragment){//匹配题作答部分
            ((MultiChildFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildBriefListAnswerFragment){//多答题点简答题
            ((ChildBriefListAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildBriefNoAskAnswerFragment){//无题干简答题
            ((ChildBriefNoAskAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof TranslateChapterAnswerFragment){//篇章翻译
            ((TranslateChapterAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof PracticeCorrectMistakesFragment){//改错题
            ((PracticeCorrectMistakesFragment)fragment).adjustFontSize();
        }else if(fragment instanceof OptionFragment){//匹配题
            ((OptionFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ClozeFragment){//完型填空
            ((ClozeFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ReadMatchFragment){//阅读匹配
            ((ReadMatchFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ParagraphSortingFragment){//段落排序
            ((ParagraphSortingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof OptionLookingFragment){//词汇匹配
            ((OptionLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof LookingCorrectMistakesFragment){//改错题
            ((LookingCorrectMistakesFragment)fragment).adjustFontSize();
        }else if(fragment instanceof AnalysisCorrectMistakesFragment){//改错题
            ((AnalysisCorrectMistakesFragment)fragment).adjustFontSize();
        }else if(fragment instanceof WebQuesBodyLookingFragment){//带交互的题干查看数据
            ((WebQuesBodyLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof PassageDictationLookReviewFragment){//通用简答查看作答
            ((PassageDictationLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildMatchLookReviewFragment){//段落匹配小题查看评阅
            ((ChildMatchLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildReadMatchLookReviewFragment){//阅读匹配小题查看评阅
            ((ChildReadMatchLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildFillLookReviewFragment){//填空题查看作答
            ((ChildFillLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ParagraphSortingChildLookingFragment){//段落排序，多项对应查看评阅
            ((ParagraphSortingChildLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompositionLookReviewFragment){//作文题查看评阅
            ((CompositionLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof TranslateChapterAnswerLookingFragment){//翻译题查看评阅
            ((TranslateChapterAnswerLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ListenMatchAnalysisFragment){//听力综合
            ((ListenMatchAnalysisFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ListenParagraphAnalysisFragment){//听力匹配，听力综合，听力排序 查看
            ((ListenParagraphAnalysisFragment)fragment).adjustFontSize();
        }else if(fragment instanceof OptionOriginalLookingFragment){//词汇匹配题原题查看
            ((OptionOriginalLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof FavoriteCorrectMistakesFragment){//改错题数字化答案查看原题
            ((FavoriteCorrectMistakesFragment)fragment).adjustFontSize();
        }else if(fragment instanceof WrongCorrectMistakesFragment){//
            ((WrongCorrectMistakesFragment)fragment).adjustFontSize();
        }else if(fragment instanceof WebQuesBodyOriginalLookingFragment){//带交互的题干查看原题
            ((WebQuesBodyOriginalLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompoundMatchQuseBodyFragment){
            ((CompoundMatchQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompoundMatchQuseBodyLookingFragment){
            ((CompoundMatchQuseBodyLookingFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompoundWritingQuesBodyFragment){
            ((CompoundWritingQuesBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof EmptyQuseBodyFragment){
            ((EmptyQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof HightLightQuseBodyFragment){
            ((HightLightQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ListenArticleQuseBodyFragment){
            ((ListenArticleQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof NormalQuseBodyFragment){
            ((NormalQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof TranslationQuseBodyFragment){
            ((TranslationQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof WanXingFillQuseBodyFragment){
            ((WanXingFillQuseBodyFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildSpokenAnswerFragment){//口语题
            ((ChildSpokenAnswerFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildSelectLookReviewFragment){//选择查看作答
            ((ChildSelectLookReviewFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildSelectOriginalFragment){//选择原题
            ((ChildSelectOriginalFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildFillOriginalFragment){
            ((ChildFillOriginalFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildMatchOriginalFragment){
            ((ChildMatchOriginalFragment)fragment).adjustFontSize();
        }else if(fragment instanceof ChildReadMatchOriginalFragment){
            ((ChildReadMatchOriginalFragment)fragment).adjustFontSize();
        }else if(fragment instanceof CompositionOriginalFragment){
            ((CompositionOriginalFragment)fragment).adjustFontSize();
        }else if(fragment instanceof PassageDictationOriginalFragment){
            ((PassageDictationOriginalFragment)fragment).adjustFontSize();
        }
    }


    /**
     * 标记小题
     */

    public static void markQuestion(Fragment fragment) {
        if (fragment instanceof SpliteLayoutFragment) {
            ((SpliteLayoutFragment) fragment).markQuestion();
        } else if (fragment instanceof NoSpliteLayoutFragment) {
            ((NoSpliteLayoutFragment) fragment).markQuestion();
        } else if (fragment instanceof ChildSelectAnswerFragment) {//选择
            ((ChildSelectAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof ChildBriefListAnswerFragment) {//一题多空简答
            ((ChildBriefListAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof ChildBriefAnswerFragment) {//有题干简答
            ((ChildBriefAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof ChildBriefNoAskAnswerFragment) {//无题干简答
            ((ChildBriefNoAskAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof CompositionAnswerFragment) {//作文题
            ((CompositionAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof ChildSpokenAnswerFragment) {//口语题
            ((ChildSpokenAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof TranslateChapterAnswerFragment) {//篇章翻译
            ((TranslateChapterAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof PassageDictationAnswerFragment) {//短文听写
            ((PassageDictationAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof PracticeCorrectMistakesFragment) {//改错题
            ((PracticeCorrectMistakesFragment) fragment).markQuestion();
        } else if (fragment instanceof OptionFragment) {//词汇匹配
            ((OptionFragment) fragment).markQuestion();
        } else if (fragment instanceof ClozeFragment) {//完型填空
            ((ClozeFragment) fragment).markQuestion();
        } else if (fragment instanceof ReadMatchFragment) {//阅读匹配
            ((ReadMatchFragment) fragment).markQuestion();
        } else if (fragment instanceof ParagraphSortingFragment) {//段落排序
            ((ParagraphSortingFragment) fragment).markQuestion();
        } else if (fragment instanceof FillChildFragment) {//听力填空
            ((FillChildFragment) fragment).markQuestion();
        } else if (fragment instanceof ListenParagraphFragment) {//听力匹配
            ((ListenParagraphFragment) fragment).markQuestion();
        } else if (fragment instanceof ListenMatchAnswerFragment) {//听力综合
            ((ListenMatchAnswerFragment) fragment).markQuestion();
        } else if (fragment instanceof MultiChildFragment) {//综合匹配
            ((MultiChildFragment) fragment).markQuestion();
        }
    }

    /**
     * 更新图片作答
     */
    public static void updateImgAnswerCallBack(Fragment fragment, ImgAnswerCallBackBean bean){
        if(fragment instanceof SpliteLayoutFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment:fragments){
                updateImgAnswerCallBack(childFragment,bean);
            }
        }else if(fragment instanceof CompositionAnswerFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment:fragments){
                updateImgAnswerCallBack(childFragment,bean);
            }
        }else if(fragment instanceof PassageDictationAnswerFragment){
            FragmentManager childFragmentManager = fragment.getChildFragmentManager();
            List<Fragment> fragments = childFragmentManager.getFragments();
            for (Fragment childFragment:fragments){
                updateImgAnswerCallBack(childFragment,bean);
            }
        }else if(fragment instanceof CompositionPictureAnswerFragment){
            ((CompositionPictureAnswerFragment)fragment).updateImgAnswerCallBack(bean);
        }
    }

}
